<?php 
/* 
Function to check Alexa rank 
*/ 
function get_alexa($url){ 
    $site = fopen('http://www.alexa.com/data/details/main?url='.urlencode($url),'r'); 
    while($cont = fread($site,1024657)){ 
        $total .= $cont; 
    } 
    fclose($site); 
    $match_expression = '/for more information about the Alexa Web Information Service.-->(.*)<\/span><\/a>/Us'; 
    preg_match($match_expression,$total,$matches); 
    return strip_tags($matches[1]); 
} 
/* 
Function to check Google Backlinks 
*/ 
function google_backs($url){ 
    $site = fopen('http://www.google.com/search?q=link%3A'.urlencode($url),'r'); 
    while($cont = fread($site,1024657)){ 
        $total .= $cont; 
    } 
    fclose($site); 
    $match_expression = '/of about <b>(.*)<\/b> linking to/Us'; 
    preg_match($match_expression,$total,$matches); 
    return $matches[1]; 
} 
/* 
Functin to check MSN Backlinks 
*/ 
if($link)
    {
    }
  else
    {
function msn_backs($url){ 
    $site = fopen('http://search.live.com/results.aspx?q=link%3A'.urlencode($url),'r'); 
    while($cont = fread($site,1024657)){ 
        $total .= $cont; 
    } 
    fclose($site); 
    $match_expression = '/<h5>Page 1 of (.*) results<\/h5>/Us'; 
    preg_match($match_expression,$total,$matches); 
    return $matches[1]; 
} }
/* 
Function to check Yahoo Backlinks (Called inlinks) 
*/ 
function yahoo_backs($url){ 
    $site = fopen('http://siteexplorer.search.yahoo.com/search?p='.urlencode($url).'&bwm=i&bwmf=a&bwms=p','r'); 
    while($cont = fread($site,1024657)){ 
        $total .= $cont; 
    } 
    fclose($site); 
    $match_expression = '/of about <strong>(.*) <\/strong>/Us'; 
    preg_match($match_expression,$total,$matches); 
    return $matches[1]; 
} 

/* 
Example Usage: 
 
$link = 'http://www.google.com'; */
$link = $_POST["checkurl"];


?>
